import {
  queryHeaderOptionList, queryBjfhList,
  queryLjfhList, queryKhfhLeftList,
  queryKhfhRightList,
  queryTemplateOptionList
} from '@/api/financial/voucher'
export default {
  data() {
    return {
      khfhLeftData: [],
      viewFieData: [],
      bjfhData: [],
      khfhRightData: [],
      ljfhData: []
    }
  },
  created() {
    this.isClassifyDialog = true
    this.fieldList() // 字段
    this.khfhLeftList() // (
    this.bjfhList() // 比较
    this.khfhRightList() // )
    this.LjfhList() // 逻辑
  },
  methods: {
    // 字段
    fieldList() { // 业务分类条件  :   分录行条件
      const api = this.title === '业务分类条件设置' ? queryHeaderOptionList : queryTemplateOptionList
      api({ ftempId: this.ftempId }).then(res => {
        this.viewFieData = res.data.list
      })
    },
    // 左括号
    khfhLeftList() {
      if (this.khfhLeftData.length > 0) return
      queryKhfhLeftList({}).then(res => {
        this.khfhLeftData = res.data.list
      })
    },
    // 比较
    bjfhList() {
      if (this.bjfhData.length > 0) return
      queryBjfhList({}).then(res => {
        this.bjfhData = res.data.list
      })
    },
    // )
    khfhRightList() {
      if (this.khfhRightData.length > 0) return
      queryKhfhRightList({}).then(res => {
        this.khfhRightData = res.data.list
      })
    },
    // 逻辑
    LjfhList() {
      if (this.ljfhData.length > 0) return
      queryLjfhList({}).then(res => {
        this.ljfhData = res.data.list
      })
    }
  }
}
